import request from '@/http/request'

// 示例：获取用户信息
export const fetchBookList = async (param = {}) => {
  try {
    const response = await request<any>({
      url: '/books/list',
      method: 'GET',
      data: param
    })

    return response
  } catch (error) {
    console.error('获取用户信息失败:', error)
  }
}

export const fetchNewsBookList = async (param = {}) => {
  try {
    const response = await request<any>({
      url: '/books/tail',
      method: 'GET',
      data: param
    })

    return response
  } catch (error) {
    console.error('获取新书列表失败:', error)
  }
}

export const fetchBookDetailById = async (id) => {
  try {
    const response = await request<any>({
      url: `/books/${id}`,
      method: 'GET',
      data: {}
    })

    return response
  } catch (error) {
    console.error('获取新书列表失败:', error)
  }
}
